<?php TPL::output('global/header_meta.tpl.htm'); ?>

<div class="aw-register-box aw-register-open-box">
	<div class="mod-head">
		<img src="<?php echo G_STATIC_URL; ?>/css/<?php echo $this->template_name; ?>/img/login_logo.png" alt="" />
		<h1><?php _e('第三方登录'); ?></h1>
	</div>
	<div class="mod-body">
		<p><?php _e('已有账号'); ?>? <a class="aw-register-open-tabs"><?php _e('点此绑定'); ?><i class="aw-icon i-triangle-down"></i></a></p>
		<form id="login_form" method="post" class="aw-register-form collapse" onsubmit="return false" action="account/ajax/login_process/">
			<input type="hidden" name="post_hash" value="<?php echo new_post_hash(); ?>" />
			<input type="hidden" name="return_url" id="login_return_url" value="" />
			<ul>
				<li>
					<input class="aw-register-email form-control" name="user_name" type="text" placeholder="<?php _e('邮箱'); ?>/<?php _e('用户名'); ?>" value="<?php echo $this->user_name; ?>" />
				</li>
				<li>
					<input class="aw-register-pwd form-control" type="password" placeholder="<?php _e('密码'); ?>" name="password" />
				</li>
				<li>
					<button class="btn btn-large btn-blue btn-block" onclick="AWS.ajax_post($('#login_form'));return false;"><?php _e('绑定帐号'); ?></button>
				</li>
			</ul>
		</form>

		<form id="register_form" method="post" class="aw-register-form" onsubmit="return false" action="<?php echo $this->register_url; ?>">
			<ul>
				<li>
					<input name="user_name" class="aw-register-name form-control" type="text" placeholder="<?php _e('用户名'); ?>" value="<?php echo $this->user_name; ?>" />
				</li>
				<li>
					<input name="email" class="aw-register-email form-control" type="text" placeholder="<?php _e('邮箱'); ?>" value="<?php echo $this->email; ?>" />
				</li>
				<li>
					<input name="password" class="aw-register-pwd form-control" type="password" placeholder="<?php _e('密码'); ?>" />
				</li>
				<li class="last">
					<label><input type="checkbox" checked="checked" value="agree" name="agreement_chk" /> <?php _e('我同意'); ?></label> <a href="javascript:;" onclick="$('.aw-regiter-agreement').show();"><?php _e('用户协议'); ?></a>
					<div class="aw-regiter-agreement collapse">
						<i></i>
						<div class="aw-register-agreement-txt" id="register_agreement"></div>
					</div>
				</li>
				<li class="alert alert-danger collapse error_message">
					<i class="icon icon-delete"></i>
					<em></em>
				</li>
				<li>
					<button class="btn btn-large btn-blue btn-block" onclick="AWS.ajax_post($('#register_form'), AWS.ajax_processer, 'error_message'); return false;"><?php _e('确认注册'); ?></button>
				</li>
			</ul>
		</form>
	</div>
</div>

<script type="text/javascript" src="<?php echo G_STATIC_URL; ?>/js/app/login.js"></script>
<script type="text/javascript">
	$(document).ready(function () {
		$('#login_return_url').val(window.location.href);

		$.get(G_BASE_URL + '/account/ajax/register_agreement/', function (result) { $('#register_agreement').html(result.err); }, 'json');

		$('.aw-register-open-tabs').click(function() {
			if ($('#login_form').is(':visible'))
			{
				$('#login_form').hide();
				$('#register_form').show();

				$(this).removeClass('active');
			}
			else
			{
				$('#login_form').show();
				$('#register_form').hide();

				$(this).addClass('active');
			}
		});
	});
</script>

<?php TPL::output('global/footer.tpl.htm'); ?>
